package com.example.demo;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * author 陈伯瑞
 * date 2020/5/19 0019 10:54
 * version 1.0
 **/
public class UserAuthentication extends AbstractAuthenticationToken {
    private Object principal;


    public UserAuthentication(Object principal, Collection<? extends GrantedAuthority> authorities) {
        super(authorities);
        this.principal = principal;
        setAuthenticated(true);
    }

    @Override
    public Object getCredentials() {
        return null;
    }

    @Override
    public Object getDetails() {
        return null;
    }

    @Override
    public Object getPrincipal() {
        return principal;
    }

    @Override
    public boolean isAuthenticated() {
        return super.isAuthenticated();
    }


    @Override
    public String getName() {
        return null;
    }
    /**
     *
     */
}
